import 'dart:convert';

class Result {
  bool success;
  dynamic data;

  Result({this.success = true, this.data});

  factory Result.fromJson(dynamic json) {
    Map<String, dynamic> jsonObject;
    if (json is String) {
      jsonObject = jsonDecode(json);
    } else {
      jsonObject = json;
    }
    return Result(success: jsonObject['success'], data: jsonObject['data']);
  }

  Map<String, dynamic> toJson() {
    return {'success': success, 'data': data};
  }

  @override
  String toString() {
    return jsonEncode(this);
  }
}

class Data {
  List<Projects> projects;

  Data({required this.projects});

  factory Data.fromJson(dynamic json) {
    Map<String, dynamic> jsonObject;
    if (json is String) {
      jsonObject = jsonDecode(json);
    } else {
      jsonObject = json;
    }
    var projects = (jsonObject['projects'] as List<dynamic>).map((value) => Projects.fromJson(value)).toList();
    return Data(projects: projects);
  }

  Map<String, dynamic> toJson() {
    return {'projects': projects};
  }

  @override
  String toString() {
    return jsonEncode(this);
  }
}

class Projects {
  String? name;
  String? url;

  Projects({this.name, this.url});

  factory Projects.fromJson(dynamic json) {
    Map<String, dynamic> jsonObject;
    if (json is String) {
      jsonObject = jsonDecode(json);
    } else {
      jsonObject = json;
    }
    return Projects(name: jsonObject['name'], url: jsonObject['url']);
  }

  Map<String, dynamic> toJson() {
    return {'name': name, 'url': url};
  }

  @override
  String toString() {
    return jsonEncode(this);
  }
}
